package com.zhoutao123.article.dubbo.provider.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

public class CustomerBeanDefinitionPostProcess implements BeanFactoryPostProcessor {
  @Override
  public void postProcessBeanFactory(ConfigurableListableBeanFactory factory)
      throws BeansException {
    BeanDefinition definition = factory.getBeanDefinition("BEAN_NAME");
    // 设置Bean为懒加载
    definition.setLazyInit(true);

    // ... 等等其他修改BeanDefinition的途径
  }
}
